<template>
	<view class="selecttitle">
		<view class="" style="height: 70rpx;line-height: 70rpx;padding-left: 30rpx;">
			请选择相关订单
		</view>
		<scroll-view class="listbox" @scrolltolower='scrolltolowerFn()' scroll-y="true">
			<view class="list-item" v-for="(i,x) in orderList" :key="x" @click="selecet(i.order_sn)">
				<view class="right">
					<view class="row1">

						<text style="font-size: 26rpx;">订单号:{{i.order_sn}}</text>
					</view>
					<view class="row2">
						<view class="row2-left">
							<image :src="i.item[0].goods_image" mode="aspectFill" style="width: 160rpx;
						height: 160rpx;"></image>
						</view>
						<view class="row2-right">
							<view class="" style="margin-bottom: 10rpx;">{{i.item[0].goods_title}}</view>
							<view class="" style="margin-bottom: 10rpx;">规格:{{i.item[0].goods_sku_text}}</view>
							<view class="" style="margin-bottom: 10rpx;">租期:{{i.stages.length}}</view>

						</view>
					</view>
				</view>
			</view>
		</scroll-view>
		<!-- <view class="btnbox">
			<view class="btnok">
				确定
			</view>
		</view> -->

	</view>
</template>

<script>
	export default {
		data() {
			return {
				currentPage: 1,
				orderList: []
			}
		},
		mounted() {
			this.getOrderList()
		},
		methods: {
			scrolltolowerFn() {
				console.log(123);
			},
			getOrderList() {
				this.$http('order.index', {
					type: 'all',
					page: this.currentPage
				}, '加载中...').then(res => {

					console.log(res);
					if (res.code === 1) {
						this.orderList = [...this.orderList, ...res.data.data];
						// that.isEmpty = !that.orderList.length;
						// that.lastPage = res.data.last_page;
						// that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
					}
				});
			},
			selecet(sn){
					
				this.$emit('selectorder',sn)
				
			}


		}
	}
</script>

<style lang="scss" scoped>
	.selecttitle {
		width: 100%;
		height: 1000rpx;

	}

	.listbox {
		height: 890rpx;
		.list-item {
			// height: 400rpx;
			width: 100%;
			// background-color: aquamarine;
			margin-bottom: 20rpx;
			padding: 0 20rpx;
			box-sizing: border-box;
			display: flex;
			justify-content: space-between;

			.left {
				width: 60rpx;

			}

			.right {
				width: 100%;
				height: 100%;
				background-color: #f0f0f0;
				border-radius: 20rpx;
				padding: 20rpx;
				box-sizing: border-box;
				.row1 {
					display: flex;
					justify-content: space-between;
				}

				.row2 {
					display: flex;
				padding: 20rpx 0;
				box-sizing: border-box;

					.row2-left {
						width: 160rpx;
						height: 160rpx;
						// margin-right: 20rpx;
						overflow: hidden;
						border-radius: 20rpx;
					}

					.row2-right {
						width: 100%;
						height: 100%;
						padding-left: 20rpx;
						font-size: 24rpx;
						color: #666;
					}
				}
			}
		}
	}

	.btnbox {
		height: 140rpx;
		background-color: #fff;

		.btnok {
			border-radius: 40rpx;
			margin: 0 auto;
			margin-top: 20rpx;
			width: 90%;
			height: 80rpx;
			text-align: center;
			line-height: 80rpx;
			background-color: #f9675c;
			color: #fff;
		}
	}
</style>
